﻿namespace System.ComponentModel.DataAnnotations.Schema
{
    /// <summary>
    /// 
    /// </summary>
    [AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
    public sealed class DecimalPrecisionAttribute : Attribute
    {
        /// <summary>
        /// 初始化一个 <see cref="DecimalPrecisionAttribute"/> 的新实例
        /// </summary>
        /// <param name="precision">精度（字段长度）</param>
        /// <param name="scale">范围（小数位数）</param>
        public DecimalPrecisionAttribute(byte precision, byte scale)
        {
            this.Precision = precision;
            this.Scale = scale;
        }

        /// <summary>
        /// 精度（字段长度）
        /// </summary>
        public byte Precision { get; set; }

        /// <summary>
        /// 范围（小数位数）
        /// </summary>
        public byte Scale { get; set; }
    }
}
